package Operation;

import Dao.DataOperation;

import java.util.Scanner;

/**
 * 删除图书记录功能类
 */
public class RemoveOperation implements IOperation{

    @Override
    public void operate() {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入您要删除的图书ID：");
        String id = in.next();
        in.nextLine();//过滤多余的换行符
        //删除表中指定ID的图书记录
        String sql = "delete from book_list where id = ?";
        boolean isUpdated = DataOperation.update(sql, id);
        if (isUpdated){
            System.out.println("删除成功!");
        }else{
            System.out.println("图书列表中不存在您要删除的图书ID!");
        }
    }
}
